const mysql = require('mysql2/promise');

const dbConfig = {
  host: process.env.DB_HOST || "43.143.253.188",
  port: parseInt(process.env.DB_PORT || "3306", 10),
  user: process.env.DB_USER || "nextjs",
  password: process.env.DB_PASS || "yEAiRE2jcxTyRBy5",
  database: process.env.DB_NAME || "nextjs",
  charset: 'utf8mb4',
  timezone: '+08:00',
};

async function simpleCheck() {
  let connection;
  
  try {
    console.log('🔍 简单检查...');
    connection = await mysql.createConnection(dbConfig);
    console.log('✅ 连接成功');
    
    // 直接查询赤壁期数
    console.log('\n📋 查询赤壁期数:');
    const [chibiRounds] = await connection.execute('SELECT * FROM casino_chibi_rounds ORDER BY id DESC');
    console.log(`找到 ${chibiRounds.length} 条记录`);
    
    chibiRounds.forEach(round => {
      console.log(`ID: ${round.id}, 状态: ${round.status}, 获胜方: ${round.winning_side}, 战报: ${round.battle_report}`);
    });
    
    // 直接查询大小期数
    console.log('\n📋 查询大小期数:');
    const [diceRounds] = await connection.execute('SELECT * FROM casino_dice_rounds ORDER BY id DESC LIMIT 3');
    console.log(`找到 ${diceRounds.length} 条记录`);
    
    diceRounds.forEach(round => {
      console.log(`ID: ${round.id}, 状态: ${round.status}, 结果: ${round.num1},${round.num2},${round.num3}`);
    });
    
  } catch (error) {
    console.error('❌ 错误:', error.message);
  } finally {
    if (connection) {
      await connection.end();
    }
  }
}

simpleCheck();
